<%--
  Created by IntelliJ IDEA.
  User: lxm
  Date: 2017/12/24
  Time: 下午7:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>家政服务发布</title>

    <link href="../css/style.css" rel="stylesheet" type="text/css" media="all"/>
    <!-- Custom Theme files -->
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="keywords"
          content="Login form web template, Sign up Web Templates, Flat Web Templates, Login signup Responsive web template, Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design"/>
    <script type="application/javascript" src="../js/jquery-1.9.1.min.js"></script>

</head>
<body>
<h2></h2>
<div class="login-top" style="border-radius: 50px;">
    <h1>构建家政信息</h1>
    <form id="form" style="">
        <input id="name" type="text" name="servant_name" value="家政人员名称" onfocus="this.value = '';"
               onblur="if (this.value == '') {this.value = '家政人员名称';}">
        <input id="phone" type="text" name="phone" value="联系方式" onfocus="this.value = '';"
               onblur="if (this.value == '') {this.value = '联系方式';}">
        <input id="price" type="text" name="service_price" value="服务价格" onfocus="this.value = '';"
               onblur="if (this.value == '') {this.value = '服务价格';}">
        <input id="sname" type="text" name="service_name" value="服务名称" onfocus="this.value = '';"
               onblur="if (this.value == '') {this.value = '服务名称';}">
        <input id="way" type="text" name="service_way" value="服务方式" onfocus="this.value = '';"
               onblur="if (this.value == '') {this.value = '服务方式';}">
        <input id="range" type="text" name="service_range" value="服务范围" onfocus="this.value = '';"
               onblur="if (this.value == '') {this.value = '服务范围';}">
        <input id="title" type="text" name="service_title" value="服务简介" onfocus="this.value = '';"
               onblur="if (this.value == '') {this.value = '服务简介';}">
        <input id="content" type="text" name="service_content" value="服务描述" onfocus="this.value = '';"
               onblur="if (this.value == '') {this.value = '服务描述';}">

    </form>
    <div class="forgot">
        <input type="button" onclick="postData()" value="提交" style="    background: #F45B4B;
    color: #FFF;
    font-size: 17px;
    font-weight: 400;
    padding: 8px 7px;
    width: 20%;
    display: inline-block;
    cursor: pointer;
    border-radius: 6px;
    -webkit-border-radius: 19px;
    -moz-border-radius: 6px;
    -o-border-radius: 6px;
    margin: 0px 250px 0px 3px;
    outline: none;
    border: none;width: 88%">
        <br />        <br />

        <input type="reset" value="重置" style="    background: #818181;
    color: #FFF;
    font-size: 17px;
    font-weight: 400;
    padding: 8px 7px;
    width: 20%;
    display: inline-block;
    cursor: pointer;
    border-radius: 6px;
    -webkit-border-radius: 19px;
    -moz-border-radius: 6px;
    -o-border-radius: 6px;
    margin: 0px 250px 0px 3px;
    outline: none;
    border: none;width: 88%">
    </div>

</div>
</div>
<script>

    function postData() {
        var jsonStr="{\n" +
            "        \n" +
            "        \"servant_name\": \""+document.getElementById('name').value+"\",\n" +
            "        \"servant_img\": \"www.baidu.com\",\n" +
            "        \"phone\": \""+document.getElementById('phone').value+"\",\n" +
            "        \"service_price\": \""+document.getElementById('price').value+"\",\n" +
            "        \"service_name\": \""+document.getElementById('sname').value+"\",\n" +
            "        \"service_way\": \""+document.getElementById('way').value+"\",\n" +
            "        \"service_range\": \""+document.getElementById('range').value+"\",\n" +
            "        \"service_title\": \""+document.getElementById('title').value+"\",\n" +
            "        \"service_content\": \""+document.getElementById('content').value+"\"\n" +
            "    }";

        console.log(jsonStr);

        $.ajax({
            type: "POST",
            url: "/api/service/hourse_keeping/add",
            contentType: "application/json", //必须有
            dataType: "json", //表示返回值类型，不必须
            data: jsonStr,
            success: function (jsonResult) {
                alert('添加成功');
            }

        });
    }
</script>
</body>
</html>
